package justGUI;

import java.awt.EventQueue;
import java.awt.Frame;

import javax.swing.JFrame;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.RowSpec;
import com.jgoodies.forms.factories.FormFactory;
import javax.swing.JButton;
import javax.swing.BoxLayout;
import java.awt.GridLayout;
import javax.swing.JLabel;
import javax.swing.JInternalFrame;
import javax.swing.JPanel;
import java.awt.FlowLayout;
import java.awt.Font;
import net.miginfocom.swing.MigLayout;
import javax.swing.SwingConstants;
import javax.swing.SpringLayout;
import java.awt.BorderLayout;
import javax.swing.JTextField;

import java.awt.Dimension;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.Component;
import java.awt.Toolkit;

import javax.swing.Box;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Color;

public class Grid {

	private JFrame frame;
	private boolean maximized = true;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Grid window = new Grid();
					window.frame.setVisible(true);
					
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public Grid() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		
		frame = new JFrame();
		Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
		frame.setBounds(0,0,screen.width,screen.height);
		
		frame.setUndecorated(maximized);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.X_AXIS));
		
		JPanel outerPanel = new JPanel();
		outerPanel.setBackground(Color.RED);
		frame.getContentPane().add(outerPanel);
		SpringLayout sl_outerPanel = new SpringLayout();
		outerPanel.setLayout(sl_outerPanel);
		
		JLabel lblTitle = new JLabel("HH Academic Bowl");
		lblTitle.setFont(new Font("Impact", Font.PLAIN, 69));
		sl_outerPanel.putConstraint(SpringLayout.NORTH, lblTitle, 30, SpringLayout.NORTH, outerPanel);
		sl_outerPanel.putConstraint(SpringLayout.WEST, lblTitle, ((frame.getWidth()-lblTitle.getPreferredSize().width)/2), SpringLayout.WEST, outerPanel);
		System.out.println();
		outerPanel.add(lblTitle);
		
		int internalPanelPadding = 65;
		JPanel internalPanel = new JPanel();
		internalPanel.setBackground(Color.LIGHT_GRAY);
		sl_outerPanel.putConstraint(SpringLayout.NORTH, internalPanel, 30, SpringLayout.SOUTH, lblTitle);
		sl_outerPanel.putConstraint(SpringLayout.WEST, internalPanel, internalPanelPadding, SpringLayout.WEST, outerPanel);
		sl_outerPanel.putConstraint(SpringLayout.SOUTH, internalPanel, -internalPanelPadding, SpringLayout.SOUTH, outerPanel);
		sl_outerPanel.putConstraint(SpringLayout.EAST, internalPanel, -internalPanelPadding, SpringLayout.EAST, outerPanel);
		outerPanel.add(internalPanel);
		SpringLayout sl_internalPanel = new SpringLayout();
		internalPanel.setLayout(sl_internalPanel);
		
		JPanel panel = new JPanel();
		sl_internalPanel.putConstraint(SpringLayout.NORTH, panel, 0, SpringLayout.NORTH, internalPanel);
		sl_internalPanel.putConstraint(SpringLayout.WEST, panel, 0, SpringLayout.WEST, internalPanel);
		sl_internalPanel.putConstraint(SpringLayout.SOUTH, panel, (internalPanel.getHeight()/20), SpringLayout.NORTH, internalPanel);
		sl_internalPanel.putConstraint(SpringLayout.EAST, panel, 0, SpringLayout.EAST, internalPanel);
		System.out.println(internalPanel.getPreferredSize().height / 20);
		internalPanel.add(panel);
	}
}
